<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>日历类 &mdash; CodeIgniter 3.0.0 中文手册|用户手册|用户指南|中文文档</title>
  

  
  
  <link rel="shortcut icon" href="../_static/ci-icon.ico" />
  

  
  <link href="../_static/css/fonts.css" rel="stylesheet" type="text/css" />

  
  
    

  

  
  
  <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
  

  
  <link rel="stylesheet" href="../_static/css/theme_cn.css" type="text/css" />
    <link rel="top" title="CodeIgniter 3.0.0 中文手册|用户手册|用户指南|中文文档" href="../index.html"/>
        <link rel="up" title="类库参考" href="index.html"/>
        <link rel="next" title="购物车类" href="cart.html"/>
        <link rel="prev" title="缓存驱动器" href="caching.html"/> 

  
  <script src="../_static/js/modernizr.2.6.2.min.js"></script>

</head>

<body class="wy-body-for-nav" role="document">

  <div id="nav">
  <div id="nav_inner">
    
    
    
      <div id="pulldown-menu" class="ciNav">
        <ul>
<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">欢迎使用 CodeIgniter</a><ul class="simple">
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">安装说明</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">下载 CodeIgniter</a></li>
<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">安装说明</a></li>
<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">从老版本升级</a></li>
<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">疑难解答</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter 概览</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">开始</a></li>
<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter 是什么？</a></li>
<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">支持特性</a></li>
<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">应用程序流程图</a></li>
<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">模型 - 视图 - 控制器</a></li>
<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">架构目标</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">教程 - 内容提要</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">加载静态内容</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">读取新闻条目</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">创建新闻条目</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">结束语</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">向 CodeIgniter 贡献你的力量</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">编写 CodeIgniter 的文档</a></li>
<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer's Certificate of Origin 1.1</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../general/index.html">常规主题</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URL</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">控制器</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">保留名称</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/views.html">视图</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/models.html">模型</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">使用 CodeIgniter 类库</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">创建类库</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">使用 CodeIgniter 驱动器</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">创建驱动器</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">创建核心系统类</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">创建附属类</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">钩子 - 扩展框架核心</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">自动加载资源</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">公共函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">兼容性函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI 路由</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">错误处理</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">网页缓存</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">程序分析</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">以 CLI 方式运行</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">管理你的应用程序</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">处理多环境</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">在视图文件中使用 PHP 替代语法</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/security.html">安全</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP 开发规范</a></li>
</ul>
</li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="index.html">类库参考</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="benchmark.html">基准测试类</a></li>
<li class="toctree-l2"><a class="reference internal" href="caching.html">缓存驱动器</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="">日历类</a></li>
<li class="toctree-l2"><a class="reference internal" href="cart.html">购物车类</a></li>
<li class="toctree-l2"><a class="reference internal" href="config.html">配置类</a></li>
<li class="toctree-l2"><a class="reference internal" href="email.html">Email 类</a></li>
<li class="toctree-l2"><a class="reference internal" href="encrypt.html">加密类</a></li>
<li class="toctree-l2"><a class="reference internal" href="encryption.html">加密类（新版）</a></li>
<li class="toctree-l2"><a class="reference internal" href="file_uploading.html">文件上传类</a></li>
<li class="toctree-l2"><a class="reference internal" href="form_validation.html">表单验证类</a></li>
<li class="toctree-l2"><a class="reference internal" href="ftp.html">FTP 类</a></li>
<li class="toctree-l2"><a class="reference internal" href="image_lib.html">图像处理类</a></li>
<li class="toctree-l2"><a class="reference internal" href="input.html">输入类</a></li>
<li class="toctree-l2"><a class="reference internal" href="javascript.html">Javascript 类</a></li>
<li class="toctree-l2"><a class="reference internal" href="language.html">语言类</a></li>
<li class="toctree-l2"><a class="reference internal" href="loader.html">加载器类</a></li>
<li class="toctree-l2"><a class="reference internal" href="migration.html">迁移类</a></li>
<li class="toctree-l2"><a class="reference internal" href="output.html">输出类</a></li>
<li class="toctree-l2"><a class="reference internal" href="pagination.html">分页类</a></li>
<li class="toctree-l2"><a class="reference internal" href="parser.html">模板解析类</a></li>
<li class="toctree-l2"><a class="reference internal" href="security.html">安全类</a></li>
<li class="toctree-l2"><a class="reference internal" href="sessions.html">Session 类</a></li>
<li class="toctree-l2"><a class="reference internal" href="table.html">HTML 表格类</a></li>
<li class="toctree-l2"><a class="reference internal" href="trackback.html">引用通告类</a></li>
<li class="toctree-l2"><a class="reference internal" href="typography.html">排版类</a></li>
<li class="toctree-l2"><a class="reference internal" href="unit_testing.html">单元测试类</a></li>
<li class="toctree-l2"><a class="reference internal" href="uri.html">URI 类</a></li>
<li class="toctree-l2"><a class="reference internal" href="user_agent.html">用户代理类</a></li>
<li class="toctree-l2"><a class="reference internal" href="xmlrpc.html">XML-RPC 与 XML-RPC 服务器类</a></li>
<li class="toctree-l2"><a class="reference internal" href="zip.html">Zip 编码类</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../database/index.html">数据库参考</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../database/examples.html">数据库快速入门: 示例代码</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/configuration.html">数据库配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/connecting.html">连接数据库</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/queries.html">查询</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/results.html">生成查询结果</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/helpers.html">查询辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/query_builder.html">查询构造器类</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/transactions.html">事务</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/metadata.html">获取元数据</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/call_function.html">自定义函数调用</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/caching.html">查询缓存</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/forge.html">使用 Database Forge 维护数据库</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/utilities.html">数据库工具类</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/db_driver_reference.html">数据库驱动器参考</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">辅助函数参考</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">数组辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">验证码辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie 辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">日期辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">目录辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">下载辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">邮件辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">文件辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">表单辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML 辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector 辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">语言辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">数字辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">路径辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">安全辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">表情辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">字符串辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">文本辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">排版辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL 辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML 辅助函数</a></li>
</ul>
</li>
</ul>

      </div>
    
      
  </div>
</div>
<div id="nav2">
  <a href="#" id="openToc">
    <img src="" title="切换目录" alt="切换目录" />
  </a>
</div>

  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-nav-search">
        
          <a href="../index.html" class="fa fa-home"> CodeIgniter</a>
        
        
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="搜索手册" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
      </div>

      <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
        
          
          
              <ul>
<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">欢迎使用 CodeIgniter</a><ul class="simple">
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">安装说明</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">下载 CodeIgniter</a></li>
<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">安装说明</a></li>
<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">从老版本升级</a></li>
<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">疑难解答</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter 概览</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">开始</a></li>
<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter 是什么？</a></li>
<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">支持特性</a></li>
<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">应用程序流程图</a></li>
<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">模型 - 视图 - 控制器</a></li>
<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">架构目标</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">教程 - 内容提要</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">加载静态内容</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">读取新闻条目</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">创建新闻条目</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">结束语</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">向 CodeIgniter 贡献你的力量</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">编写 CodeIgniter 的文档</a></li>
<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer's Certificate of Origin 1.1</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../general/index.html">常规主题</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URL</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">控制器</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">保留名称</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/views.html">视图</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/models.html">模型</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">使用 CodeIgniter 类库</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">创建类库</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">使用 CodeIgniter 驱动器</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">创建驱动器</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">创建核心系统类</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">创建附属类</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">钩子 - 扩展框架核心</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">自动加载资源</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">公共函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">兼容性函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI 路由</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">错误处理</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">网页缓存</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">程序分析</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">以 CLI 方式运行</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">管理你的应用程序</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">处理多环境</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">在视图文件中使用 PHP 替代语法</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/security.html">安全</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP 开发规范</a></li>
</ul>
</li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="index.html">类库参考</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="benchmark.html">基准测试类</a></li>
<li class="toctree-l2"><a class="reference internal" href="caching.html">缓存驱动器</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="">日历类</a></li>
<li class="toctree-l2"><a class="reference internal" href="cart.html">购物车类</a></li>
<li class="toctree-l2"><a class="reference internal" href="config.html">配置类</a></li>
<li class="toctree-l2"><a class="reference internal" href="email.html">Email 类</a></li>
<li class="toctree-l2"><a class="reference internal" href="encrypt.html">加密类</a></li>
<li class="toctree-l2"><a class="reference internal" href="encryption.html">加密类（新版）</a></li>
<li class="toctree-l2"><a class="reference internal" href="file_uploading.html">文件上传类</a></li>
<li class="toctree-l2"><a class="reference internal" href="form_validation.html">表单验证类</a></li>
<li class="toctree-l2"><a class="reference internal" href="ftp.html">FTP 类</a></li>
<li class="toctree-l2"><a class="reference internal" href="image_lib.html">图像处理类</a></li>
<li class="toctree-l2"><a class="reference internal" href="input.html">输入类</a></li>
<li class="toctree-l2"><a class="reference internal" href="javascript.html">Javascript 类</a></li>
<li class="toctree-l2"><a class="reference internal" href="language.html">语言类</a></li>
<li class="toctree-l2"><a class="reference internal" href="loader.html">加载器类</a></li>
<li class="toctree-l2"><a class="reference internal" href="migration.html">迁移类</a></li>
<li class="toctree-l2"><a class="reference internal" href="output.html">输出类</a></li>
<li class="toctree-l2"><a class="reference internal" href="pagination.html">分页类</a></li>
<li class="toctree-l2"><a class="reference internal" href="parser.html">模板解析类</a></li>
<li class="toctree-l2"><a class="reference internal" href="security.html">安全类</a></li>
<li class="toctree-l2"><a class="reference internal" href="sessions.html">Session 类</a></li>
<li class="toctree-l2"><a class="reference internal" href="table.html">HTML 表格类</a></li>
<li class="toctree-l2"><a class="reference internal" href="trackback.html">引用通告类</a></li>
<li class="toctree-l2"><a class="reference internal" href="typography.html">排版类</a></li>
<li class="toctree-l2"><a class="reference internal" href="unit_testing.html">单元测试类</a></li>
<li class="toctree-l2"><a class="reference internal" href="uri.html">URI 类</a></li>
<li class="toctree-l2"><a class="reference internal" href="user_agent.html">用户代理类</a></li>
<li class="toctree-l2"><a class="reference internal" href="xmlrpc.html">XML-RPC 与 XML-RPC 服务器类</a></li>
<li class="toctree-l2"><a class="reference internal" href="zip.html">Zip 编码类</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../database/index.html">数据库参考</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../database/examples.html">数据库快速入门: 示例代码</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/configuration.html">数据库配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/connecting.html">连接数据库</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/queries.html">查询</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/results.html">生成查询结果</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/helpers.html">查询辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/query_builder.html">查询构造器类</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/transactions.html">事务</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/metadata.html">获取元数据</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/call_function.html">自定义函数调用</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/caching.html">查询缓存</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/forge.html">使用 Database Forge 维护数据库</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/utilities.html">数据库工具类</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/db_driver_reference.html">数据库驱动器参考</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">辅助函数参考</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">数组辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">验证码辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie 辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">日期辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">目录辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">下载辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">邮件辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">文件辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">表单辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML 辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector 辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">语言辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">数字辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">路径辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">安全辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">表情辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">字符串辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">文本辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">排版辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL 辅助函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML 辅助函数</a></li>
</ul>
</li>
</ul>

          
        
      </div>
      &nbsp;
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
        <a href="../index.html">CodeIgniter</a>
      </nav>


      
      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
    <li><a href="../index.html">首页</a> &raquo; </li>
    
    <li><a href="index.html">类库参考</a> &raquo; </li>
    
    <li>日历类</li>
    <li class="wy-breadcrumbs-aside">
      
    </li>
    <div style="float:right;">
      <div style="text-decoration:underline;color:blue;margin-left:5px;cursor:pointer;" id="closeMe">
        <img title="目录" alt="toc" src="" />
      </div>
    </div>
  </ul>
  <hr/>
</div>
          <div role="main" class="document">
            
  <div class="section" id="id1">
<h1>日历类<a class="headerlink" href="#id1" title="永久链接至标题">¶</a></h1>
<p>使用日历类可以让你动态的创建日历，并且可以使用日历模板来格式化显示你的日历，
允许你 100% 的控制它设计的每个方面。另外，你还可以向日历的单元格传递数据。</p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#id2" id="id10">使用日历类</a><ul>
<li><a class="reference internal" href="#id3" id="id11">初始化类</a></li>
<li><a class="reference internal" href="#id4" id="id12">显示一个日历</a></li>
<li><a class="reference internal" href="#id5" id="id13">传数据到单元格</a></li>
<li><a class="reference internal" href="#id6" id="id14">设置显示参数</a></li>
<li><a class="reference internal" href="#id7" id="id15">显示下一月/上一月链接</a></li>
<li><a class="reference internal" href="#id8" id="id16">创建一个日历模板</a></li>
</ul>
</li>
<li><a class="reference internal" href="#id9" id="id17">类参考</a></li>
</ul>
</div>
<div class="custom-index container"></div><div class="section" id="id2">
<h2><a class="toc-backref" href="#id10">使用日历类</a><a class="headerlink" href="#id2" title="永久链接至标题">¶</a></h2>
<div class="section" id="id3">
<h3><a class="toc-backref" href="#id11">初始化类</a><a class="headerlink" href="#id3" title="永久链接至标题">¶</a></h3>
<p>跟 CodeIgniter 中的其他类一样，可以在你的控制器中使用 <tt class="docutils literal"><span class="pre">$this-&gt;load-&gt;library()</span></tt>
方法加载日历类:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;calendar&#39;</span><span class="p">);</span>
</pre></div>
</div>
<p>一旦加载，日历类就可以像下面这样使用:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">calendar</span>
</pre></div>
</div>
</div>
<div class="section" id="id4">
<h3><a class="toc-backref" href="#id12">显示一个日历</a><a class="headerlink" href="#id4" title="永久链接至标题">¶</a></h3>
<p>这里是一个简单的例子，告诉你如何去显示一个日历:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;calendar&#39;</span><span class="p">);</span>
<span class="k">echo</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">calendar</span><span class="o">-&gt;</span><span class="na">generate</span><span class="p">();</span>
</pre></div>
</div>
<p>上面的代码将根据你服务器时间创建一个当前月/年的日历。要显示一个指定月和年的日历，
你要传递这些信息到日历生成函数:</p>
<blockquote>
<div>$this-&gt;load-&gt;library('calendar');
echo $this-&gt;calendar-&gt;generate(2006, 6);</div></blockquote>
<p>上面的代码将创建一个显示 2006 年 6 月的日历，第一个参数指定了年，第二个参数指定了月。</p>
</div>
<div class="section" id="id5">
<h3><a class="toc-backref" href="#id13">传数据到单元格</a><a class="headerlink" href="#id5" title="永久链接至标题">¶</a></h3>
<p>如果需要添加数据到日历的单元格中，就要创建一个关联数组，这个数组中索引是想添加数据的日期，
数组对应的值是想添加的数据。该数组通过日历生成函数的第三个参数被传入，参考下面这个例子:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;calendar&#39;</span><span class="p">);</span>

<span class="nv">$data</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
    <span class="mi">3</span>  <span class="o">=&gt;</span> <span class="s1">&#39;http://example.com/news/article/2006/03/&#39;</span><span class="p">,</span>
    <span class="mi">7</span>  <span class="o">=&gt;</span> <span class="s1">&#39;http://example.com/news/article/2006/07/&#39;</span><span class="p">,</span>
    <span class="mi">13</span> <span class="o">=&gt;</span> <span class="s1">&#39;http://example.com/news/article/2006/13/&#39;</span><span class="p">,</span>
    <span class="mi">26</span> <span class="o">=&gt;</span> <span class="s1">&#39;http://example.com/news/article/2006/26/&#39;</span>
<span class="p">);</span>

<span class="k">echo</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">calendar</span><span class="o">-&gt;</span><span class="na">generate</span><span class="p">(</span><span class="mi">2006</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="nv">$data</span><span class="p">);</span>
</pre></div>
</div>
<p>使用上面的例子，天数为 3、7、13 和 26 将变成链接指向你提供的 URL 。</p>
<div class="admonition note">
<p class="first admonition-title">注解</p>
<p class="last">默认情况下，系统假定你的数组中包含了链接。在下面介绍日历模板的部分，
你会看到你可以自定义处理传入日历单元格的数据，所以你可以传不同类型的信息。</p>
</div>
</div>
<div class="section" id="id6">
<h3><a class="toc-backref" href="#id14">设置显示参数</a><a class="headerlink" href="#id6" title="永久链接至标题">¶</a></h3>
<p>有 8 种不同的参数可以让你设置日历的各个方面，你可以通过加载函数的第二个参数来设置参数。
例如:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$prefs</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
    <span class="s1">&#39;start_day&#39;</span>    <span class="o">=&gt;</span> <span class="s1">&#39;saturday&#39;</span><span class="p">,</span>
    <span class="s1">&#39;month_type&#39;</span>   <span class="o">=&gt;</span> <span class="s1">&#39;long&#39;</span><span class="p">,</span>
    <span class="s1">&#39;day_type&#39;</span>     <span class="o">=&gt;</span> <span class="s1">&#39;short&#39;</span>
<span class="p">);</span>

<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;calendar&#39;</span><span class="p">,</span> <span class="nv">$prefs</span><span class="p">);</span>

<span class="k">echo</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">calendar</span><span class="o">-&gt;</span><span class="na">generate</span><span class="p">();</span>
</pre></div>
</div>
<p>上面的代码将显示一个日历从礼拜六开始，使用用完整的月份标题和缩写的天数格式。
更多参数信息请看下面。</p>
<table border="1" class="docutils">
<colgroup>
<col width="15%" />
<col width="11%" />
<col width="29%" />
<col width="45%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">参数</th>
<th class="head">默认值</th>
<th class="head">选项</th>
<th class="head">描述</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><strong>template</strong></td>
<td>None</td>
<td>None</td>
<td>字符串或数组，包含了你的日历模板，见下面的模板部分。</td>
</tr>
<tr class="row-odd"><td><strong>local_time</strong></td>
<td>time()</td>
<td>None</td>
<td>当前时间的 Unix 时间戳。</td>
</tr>
<tr class="row-even"><td><strong>start_day</strong></td>
<td>sunday</td>
<td>Any week day (sunday, monday, tuesday, etc.)</td>
<td>指定每周的第一天是周几。</td>
</tr>
<tr class="row-odd"><td><strong>month_type</strong></td>
<td>long</td>
<td>long, short</td>
<td>月份的显示样式（long = January, short = Jan）</td>
</tr>
<tr class="row-even"><td><strong>day_type</strong></td>
<td>abr</td>
<td>long, short, abr</td>
<td>星期的显示样式（long = Sunday, short = Sun, abr = Su）</td>
</tr>
<tr class="row-odd"><td><strong>show_next_prev</strong></td>
<td>FALSE</td>
<td>TRUE/FALSE (boolean)</td>
<td>是否显示 &quot;上个月&quot; 和 &quot;下个月&quot; 链接，见下文。</td>
</tr>
<tr class="row-even"><td><strong>next_prev_url</strong></td>
<td>controller/method</td>
<td>A URL</td>
<td>设置 &quot;上个月&quot; 和 &quot;下个月&quot; 的链接地址。</td>
</tr>
<tr class="row-odd"><td><strong>show_other_days</strong></td>
<td>FALSE</td>
<td>TRUE/FALSE (boolean)</td>
<td>是否显示第一周和最后一周相邻月份的日期。</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="id7">
<h3><a class="toc-backref" href="#id15">显示下一月/上一月链接</a><a class="headerlink" href="#id7" title="永久链接至标题">¶</a></h3>
<p>要让你的日历通过下一月/上一月链接动态的减少/增加，可以仿照下面的例子建立你的日历:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$prefs</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
    <span class="s1">&#39;show_next_prev&#39;</span>  <span class="o">=&gt;</span> <span class="k">TRUE</span><span class="p">,</span>
    <span class="s1">&#39;next_prev_url&#39;</span>   <span class="o">=&gt;</span> <span class="s1">&#39;http://example.com/index.php/calendar/show/&#39;</span>
<span class="p">);</span>

<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;calendar&#39;</span><span class="p">,</span> <span class="nv">$prefs</span><span class="p">);</span>

<span class="k">echo</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">calendar</span><span class="o">-&gt;</span><span class="na">generate</span><span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">uri</span><span class="o">-&gt;</span><span class="na">segment</span><span class="p">(</span><span class="mi">3</span><span class="p">),</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">uri</span><span class="o">-&gt;</span><span class="na">segment</span><span class="p">(</span><span class="mi">4</span><span class="p">));</span>
</pre></div>
</div>
<p>在上面的例子中，你会注意到这几点：</p>
<ul class="simple">
<li>&quot;show_next_prev&quot; 参数必须设置为 TRUE</li>
<li>&quot;next_prev_url&quot; 参数必须设置一个 URL ，如果不设置，会默认使用当前的 <strong>控制器/方法</strong></li>
<li>通过 URI 的段将 &quot;年&quot; 和 &quot;月&quot; 参数传递给日历生成函数（日历类会自动添加 &quot;年&quot; 和 &quot;月&quot; 到你提供的 URL）</li>
</ul>
</div>
<div class="section" id="id8">
<h3><a class="toc-backref" href="#id16">创建一个日历模板</a><a class="headerlink" href="#id8" title="永久链接至标题">¶</a></h3>
<p>通过创建一个日历模板你能够 100% 的控制你的日历的设计。当使用字符串方式设置模板时，
日历的每一部分都要被放在一对伪变量中，像下面这样:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$prefs</span><span class="p">[</span><span class="s1">&#39;template&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;</span>

<span class="s1">    {table_open}&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;{/table_open}</span>

<span class="s1">    {heading_row_start}&lt;tr&gt;{/heading_row_start}</span>

<span class="s1">    {heading_previous_cell}&lt;th&gt;&lt;a href=&quot;{previous_url}&quot;&gt;&amp;lt;&amp;lt;&lt;/a&gt;&lt;/th&gt;{/heading_previous_cell}</span>
<span class="s1">    {heading_title_cell}&lt;th colspan=&quot;{colspan}&quot;&gt;{heading}&lt;/th&gt;{/heading_title_cell}</span>
<span class="s1">    {heading_next_cell}&lt;th&gt;&lt;a href=&quot;{next_url}&quot;&gt;&amp;gt;&amp;gt;&lt;/a&gt;&lt;/th&gt;{/heading_next_cell}</span>

<span class="s1">    {heading_row_end}&lt;/tr&gt;{/heading_row_end}</span>

<span class="s1">    {week_row_start}&lt;tr&gt;{/week_row_start}</span>
<span class="s1">    {week_day_cell}&lt;td&gt;{week_day}&lt;/td&gt;{/week_day_cell}</span>
<span class="s1">    {week_row_end}&lt;/tr&gt;{/week_row_end}</span>

<span class="s1">    {cal_row_start}&lt;tr&gt;{/cal_row_start}</span>
<span class="s1">    {cal_cell_start}&lt;td&gt;{/cal_cell_start}</span>
<span class="s1">    {cal_cell_start_today}&lt;td&gt;{/cal_cell_start_today}</span>
<span class="s1">    {cal_cell_start_other}&lt;td class=&quot;other-month&quot;&gt;{/cal_cell_start_other}</span>

<span class="s1">    {cal_cell_content}&lt;a href=&quot;{content}&quot;&gt;{day}&lt;/a&gt;{/cal_cell_content}</span>
<span class="s1">    {cal_cell_content_today}&lt;div class=&quot;highlight&quot;&gt;&lt;a href=&quot;{content}&quot;&gt;{day}&lt;/a&gt;&lt;/div&gt;{/cal_cell_content_today}</span>

<span class="s1">    {cal_cell_no_content}{day}{/cal_cell_no_content}</span>
<span class="s1">    {cal_cell_no_content_today}&lt;div class=&quot;highlight&quot;&gt;{day}&lt;/div&gt;{/cal_cell_no_content_today}</span>

<span class="s1">    {cal_cell_blank}&amp;nbsp;{/cal_cell_blank}</span>

<span class="s1">    {cal_cell_other}{day}{/cal_cel_other}</span>

<span class="s1">    {cal_cell_end}&lt;/td&gt;{/cal_cell_end}</span>
<span class="s1">    {cal_cell_end_today}&lt;/td&gt;{/cal_cell_end_today}</span>
<span class="s1">    {cal_cell_end_other}&lt;/td&gt;{/cal_cell_end_other}</span>
<span class="s1">    {cal_row_end}&lt;/tr&gt;{/cal_row_end}</span>

<span class="s1">    {table_close}&lt;/table&gt;{/table_close}</span>
<span class="s1">&#39;</span><span class="p">;</span>

<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;calendar&#39;</span><span class="p">,</span> <span class="nv">$prefs</span><span class="p">);</span>

<span class="k">echo</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">calendar</span><span class="o">-&gt;</span><span class="na">generate</span><span class="p">();</span>
</pre></div>
</div>
<p>当使用数组方式设置模板时，你需要传递 <cite>key =&gt; value</cite> 键值对，你可以只设置你想设置的参数，
其他没有设置的参数会使用日历类的默认值代替。</p>
<p>例子:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$prefs</span><span class="p">[</span><span class="s1">&#39;template&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
    <span class="s1">&#39;table_open&#39;</span>           <span class="o">=&gt;</span> <span class="s1">&#39;&lt;table class=&quot;calendar&quot;&gt;&#39;</span><span class="p">,</span>
    <span class="s1">&#39;cal_cell_start&#39;</span>       <span class="o">=&gt;</span> <span class="s1">&#39;&lt;td class=&quot;day&quot;&gt;&#39;</span><span class="p">,</span>
    <span class="s1">&#39;cal_cell_start_today&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;&lt;td class=&quot;today&quot;&gt;&#39;</span>
<span class="p">);</span>

<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;calendar&#39;</span><span class="p">,</span> <span class="nv">$prefs</span><span class="p">);</span>

<span class="k">echo</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">calendar</span><span class="o">-&gt;</span><span class="na">generate</span><span class="p">();</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="id9">
<h2><a class="toc-backref" href="#id17">类参考</a><a class="headerlink" href="#id9" title="永久链接至标题">¶</a></h2>
<dl class="class">
<dt id="CI_Calendar">
<em class="property">class </em><tt class="descname">CI_Calendar</tt><a class="headerlink" href="#CI_Calendar" title="永久链接至目标">¶</a></dt>
<dd><dl class="method">
<dt id="CI_Calendar::initialize">
<tt class="descname">initialize</tt><big>(</big><span class="optional">[</span><em>$config = array()</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#CI_Calendar::initialize" title="永久链接至目标">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">参数:</th><td class="field-body"><ul class="first simple">
<li><strong>$config</strong> (<em>array</em>) -- Configuration parameters</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">CI_Calendar instance (method chaining)</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">CI_Calendar</p>
</td>
</tr>
</tbody>
</table>
<p>初始化日历类参数，输入参数为一个关联数组，包含了日历的显示参数。</p>
</dd></dl>

<dl class="method">
<dt id="CI_Calendar::generate">
<tt class="descname">generate</tt><big>(</big><span class="optional">[</span><em>$year = ''</em><span class="optional">[</span>, <em>$month = ''</em><span class="optional">[</span>, <em>$data = array()</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#CI_Calendar::generate" title="永久链接至目标">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">参数:</th><td class="field-body"><ul class="first simple">
<li><strong>$year</strong> (<em>int</em>) -- Year</li>
<li><strong>$month</strong> (<em>int</em>) -- Month</li>
<li><strong>$data</strong> (<em>array</em>) -- Data to be shown in the calendar cells</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">HTML-formatted calendar</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">string</p>
</td>
</tr>
</tbody>
</table>
<p>生成日历。</p>
</dd></dl>

<dl class="method">
<dt id="CI_Calendar::get_month_name">
<tt class="descname">get_month_name</tt><big>(</big><em>$month</em><big>)</big><a class="headerlink" href="#CI_Calendar::get_month_name" title="永久链接至目标">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">参数:</th><td class="field-body"><ul class="first simple">
<li><strong>$month</strong> (<em>int</em>) -- Month</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">Month name</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">string</p>
</td>
</tr>
</tbody>
</table>
<p>提供数字格式的月份，返回月份的名称。</p>
</dd></dl>

<dl class="method">
<dt id="CI_Calendar::get_day_names">
<tt class="descname">get_day_names</tt><big>(</big><em>$day_type = ''</em><big>)</big><a class="headerlink" href="#CI_Calendar::get_day_names" title="永久链接至目标">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">参数:</th><td class="field-body"><ul class="first simple">
<li><strong>$day_type</strong> (<em>string</em>) -- 'long', 'short', or 'abr'</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">Array of day names</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">array</p>
</td>
</tr>
</tbody>
</table>
<p>根据类型返回一个包含星期名称（Sunday、Monday 等等）的数组，类型有：long、short 和 abr 。
如果没有指定 <tt class="docutils literal"><span class="pre">$day_type</span></tt> 参数（或该参数无效），方法默认使用 abr（缩写） 格式。</p>
</dd></dl>

<dl class="method">
<dt id="CI_Calendar::adjust_date">
<tt class="descname">adjust_date</tt><big>(</big><em>$month</em>, <em>$year</em><big>)</big><a class="headerlink" href="#CI_Calendar::adjust_date" title="永久链接至目标">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">参数:</th><td class="field-body"><ul class="first simple">
<li><strong>$month</strong> (<em>int</em>) -- Month</li>
<li><strong>$year</strong> (<em>int</em>) -- Year</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">An associative array containing month and year</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">array</p>
</td>
</tr>
</tbody>
</table>
<p>该方法调整日期确保日期有效。例如，如果你将月份设置为 13 ，年份将自动加 1 ，并且月份变为一月:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nb">print_r</span><span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">calendar</span><span class="o">-&gt;</span><span class="na">adjust_date</span><span class="p">(</span><span class="mi">13</span><span class="p">,</span> <span class="mi">2014</span><span class="p">));</span>
</pre></div>
</div>
<p>输出:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="k">Array</span>
<span class="p">(</span>
    <span class="p">[</span><span class="nx">month</span><span class="p">]</span> <span class="o">=&gt;</span> <span class="s1">&#39;01&#39;</span>
    <span class="p">[</span><span class="nx">year</span><span class="p">]</span> <span class="o">=&gt;</span> <span class="s1">&#39;2015&#39;</span>
<span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="CI_Calendar::get_total_days">
<tt class="descname">get_total_days</tt><big>(</big><em>$month</em>, <em>$year</em><big>)</big><a class="headerlink" href="#CI_Calendar::get_total_days" title="永久链接至目标">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">参数:</th><td class="field-body"><ul class="first simple">
<li><strong>$month</strong> (<em>int</em>) -- Month</li>
<li><strong>$year</strong> (<em>int</em>) -- Year</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">返回:</th><td class="field-body"><p class="first">Count of days in the specified month</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">返回类型:</th><td class="field-body"><p class="first last">int</p>
</td>
</tr>
</tbody>
</table>
<p>获取指定月的天数:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="k">echo</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">calendar</span><span class="o">-&gt;</span><span class="na">get_total_days</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2012</span><span class="p">);</span>
<span class="c1">// 29</span>
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">注解</p>
<p class="last">该方法是 <a class="reference internal" href="../helpers/date_helper.html"><em>日期辅助函数</em></a> 的 <a class="reference internal" href="../helpers/date_helper.html#days_in_month" title="days_in_month"><tt class="xref php php-func docutils literal"><span class="pre">days_in_month()</span></tt></a> 函数的别名。</p>
</div>
</dd></dl>

<dl class="method">
<dt id="CI_Calendar::default_template">
<tt class="descname">default_template</tt><big>(</big><big>)</big><a class="headerlink" href="#CI_Calendar::default_template" title="永久链接至目标">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">返回:</th><td class="field-body">An array of template values</td>
</tr>
<tr class="field-even field"><th class="field-name">返回类型:</th><td class="field-body">array</td>
</tr>
</tbody>
</table>
<p>默认的模板，当你没有使用你自己的模板时将会使用该方法。</p>
</dd></dl>

<dl class="method">
<dt id="CI_Calendar::parse_template">
<tt class="descname">parse_template</tt><big>(</big><big>)</big><a class="headerlink" href="#CI_Calendar::parse_template" title="永久链接至目标">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">返回:</th><td class="field-body">CI_Calendar instance (method chaining)</td>
</tr>
<tr class="field-even field"><th class="field-name">返回类型:</th><td class="field-body">CI_Calendar</td>
</tr>
</tbody>
</table>
<p>解析模板中的伪变量 <tt class="docutils literal"><span class="pre">{pseudo-variables}</span></tt> 显示日历。</p>
</dd></dl>

</dd></dl>

</div>
</div>


          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="cart.html" class="btn btn-neutral float-right" title="购物车类">下一个主题 <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="caching.html" class="btn btn-neutral" title="缓存驱动器"><span class="fa fa-arrow-circle-left"></span> 上一个主题</a>
      
    </div>
  

  
  <div id="notes">
  
  <!-- 多说评论框 start -->
    <div class="ds-thread" data-thread-key="userguide3/libraries/calendar" data-title="日历类" data-url="http://codeigniter.org.cn/user_guide/libraries/calendar.html"></div>
  <!-- 多说评论框 end -->
  

  <div class="ds-share flat" data-thread-key="userguide3/libraries/calendar" data-title="日历类 &mdash; CodeIgniter 3.0.0 中文手册|用户手册|用户指南|中文文档" data-url="http://codeigniter.org.cn/user_guide/libraries/calendar.html" data-images="" data-content="">
    <div class="ds-share-inline">
      <ul  class="ds-share-icons-16">

        <li data-toggle="ds-share-icons-more"><a class="ds-more" href="javascript:void(0);">分享到：</a></li>
        <li><a class="ds-weibo" href="javascript:void(0);" data-service="weibo">微博</a></li>
        <li><a class="ds-qzone" href="javascript:void(0);" data-service="qzone">QQ空间</a></li>
        <li><a class="ds-qqt" href="javascript:void(0);" data-service="qqt">腾讯微博</a></li>
        <li><a class="ds-wechat" href="javascript:void(0);" data-service="wechat">微信</a></li>

      </ul>
      <div class="ds-share-icons-more">
      </div>
    </div>
  </div>

  <!-- 多说公共JS代码 start (一个网页只需插入一次) -->
  <script type="text/javascript">
    var duoshuoQuery = {short_name:"codeigniter"};
    (function() {
        var ds = document.createElement('script');
        ds.type = 'text/javascript';ds.async = true;
        ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
        ds.charset = 'UTF-8';
        (document.getElementsByTagName('head')[0]
         || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
    </script>
  <!-- 多说公共JS代码 end -->
  </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; 版权所有 2014 - 2015, 不列颠哥伦比亚理工学院.
       最后修改: 2015-10-11.
    </p>

    <p>以 <a href="http://www.aneasystone.com/" target="_blank">aneasystone</a> 制作的手册为基础构建</p>
  </div>

  
    <p>基于 <a href="http://sphinx-doc.org/">Sphinx</a> 并使用 <a href="https://readthedocs.org">Read the Docs</a> 提供的<a href="https://github.com/snide/sphinx_rtd_theme">风格</a>构建</p>
    <p>
        <a href="https://github.com/CodeIgniter-Chinese/codeigniter-user-guide" target="_blank">Github 简体中文翻译</a>
        ·
        <a href="http://codeigniter-chinese.github.io/codeigniter-user-guide/codeigniter_user_guide.zip">离线版压缩包下载</a>
        ·
        <a href="http://codeigniter-chinese.github.io/codeigniter-user-guide/CodeIgniter.pdf">PDF 版下载</a>
    </p>
  

</footer>
        </div>
      </div>

    </section>

  </div>
  

  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'../',
            VERSION:'3.0.2',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE:  false
        };
    </script>
      <script type="text/javascript" src="../_static/jquery.js"></script>
      <script type="text/javascript" src="../_static/underscore.js"></script>
      <script type="text/javascript" src="../_static/doctools.js"></script>
      <script type="text/javascript" src="../_static/translations.js"></script>

  

  
  
    <script type="text/javascript" src="../_static/js/theme.js"></script>
  

  
  
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.StickyNav.enable();
      });
  </script>
   

  
    <script>
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

        ga('create', 'UA-272152-3', 'auto');
        ga('send', 'pageview');
    </script>
  

</body>
</html>